import urllib
import urllib2
 
 
# def main():
    # url = 'https://www.openssl.org/source/openssl-1.0.2h.tar.gz'
    # local_file = r'D:\Python\openssl.zip'
    # response = urllib.urlopen(url)
    # output = file(local_file, 'w')
    # try:
        # content = response.read()
        # output.write(content)
    # finally:
        # output.close()
        # response.close()
# if __name__ == '__main__':
    # main()
	
print "downloading with urllib2"
url = 'https://www.openssl.org/source/openssl-1.0.2h.tar.gz' 
f = urllib2.urlopen(url) 
data = f.read() 
with open("demo.tar.gz", "wb") as code:     
    code.write(data)
	
	
	
	
	
	
	
	